import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, useRouterHistory, IndexRedirect, Redirect } from 'react-router'
import { createHashHistory } from 'history';
import 'config/globle';
import FrameWork from 'pages/framework/layout.jsx'
import Catalogue  from 'pages/catalogue/main.jsx'
import 'styles/themes/default/index.less';
import ServiceList from 'pages/servicelist/index.jsx'
import ServiceItems from 'pages/serviceitems/index.jsx'
import NewSrvItem from 'pages/serviceitems/new.jsx'
import EditSrvItem from 'pages/serviceitems/edit.jsx'
import ServiceStandard from 'pages/serviceStandard/index.jsx'
import Service from 'pages/main.jsx'
const appHistory = useRouterHistory(createHashHistory)({ queryKey: false });
const NotFound = React.createClass({
  render() {
    return <h2>Not found</h2>
  }
});
ReactDOM.render((
  <Router history={appHistory}>
    <Route path="/catalogue" component={Catalogue} />

    <Route path="/" component={FrameWork}>
      <IndexRedirect to="service/serviceitems" />
      <Redirect from="/" to="service/serviceitems"/>
      <Route path="service" component={Service} >
        <Route path="serviceitems" component={ServiceItems} />
        <Route path="serviceitems/create" component={NewSrvItem} />
        <Route path="serviceitems/:id" component={EditSrvItem} />
        <Route path="servicelist" component={ServiceList} />
        <Route path="serviceStandard" component={ServiceStandard}/>
      </Route>
      <Route path="*" component={NotFound} />
    </Route>
  </Router>
), document.getElementById('main'));
